#include <ros/ros.h>

#include "cg_interfaces/CanFrame.h"

void OnCanFrame(const cg_interfaces::CanFrame::ConstPtr &msg)
{
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "can_node_dumy");
    ros::NodeHandle n;

    ros::Publisher can_pub = n.advertise<cg_interfaces::CanFrame>("can_upload", 1);
    ros::Subscriber can_sub = n.subscribe<cg_interfaces::CanFrame>("can_download", 1, OnCanFrame);

    ros::Rate rate(50);
    while (ros::ok())
    {
        rate.sleep();

        cg_interfaces::CanFrame msg;
        msg.id = 0x123;
        msg.data = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
        msg.chanel = 0;
        can_pub.publish(msg);
        ros::spinOnce();
    }
    ros::spin();
    return 0;
}